import { createSlice } from '@reduxjs/toolkit'
import { useSelector } from 'react-redux'

const pageCommonSlice = createSlice({
    name: 'pageCommon',
    initialState: {
        pageInfo: {
            current: 1,
            pageSize: 5,
            total: 10
        }
    },
    reducers: {
        // 更新分页信息
        upPageInfo(state, { payload }) {
            state.pageInfo = payload
        }
    }
})

export const useSelectPageCommon = () => useSelector((state: any) => state.pageCommon)
export const { upPageInfo } = pageCommonSlice.actions
export default pageCommonSlice.reducer
